﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using Microsoft.AspNetCore.Builder;

namespace NFinal.Middleware.ResourcesTest
{
    public class Startup
    {
        public void Configure(IApplicationBuilder app)
        {
            Assembly assembly = Assembly.GetEntryAssembly();
            string name = new AssemblyName(assembly.FullName).Name;
            string xmlConfigFolder = Path.GetDirectoryName(assembly.Location);
            string xmlConfigFileName = Path.Combine(xmlConfigFolder, "Resource.xml");
            var config = new NFinal.Middleware.Resources.ResourcesConfig()
            {
                ResourcesArray = new[] { new Resources.Resources(xmlConfigFileName, assembly) },
                defaultUrl = "/Index.html"
            };
            app.UseMiddleware<NFinal.Middleware.Resources.CoreResourcesMiddleware>(config);
        }
    }
}
